//////////////////////////////////////////////////////////////////////////
//	Name: CDXText.h
//	Purpose: Will Create and display text!!
//	Created: October 25, 2009 - Christian Sassi
//////////////////////////////////////////////////////////////////////////


#include "CDXText.h"
#include "CDXRenderWin32.h"
CDXText::CDXText()
{

}

CDXText::~CDXText()
{
	m_pFont->Release();
}

HRESULT CDXText::CreatFont(int nHeight, int nWidth, bool bIsItalic, string szFontName)
{
	HRESULT res;
	res = D3DXCreateFont( CDXRenderWin32::GetInstance()->GetDevice(), nHeight,nWidth, FW_BOLD, 0, bIsItalic, DEFAULT_CHARSET, 
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT(szFontName.c_str()), &m_pFont );
	return res;
}

void CDXText::DisplayText(int x, int y, D3DCOLOR d3Color, string szText)
{
	
	//TODO: Fix this rectangle shit.
	// Create a rectangle to indicate where on the screen it should be drawn
	RECT rct;
	rct.left = x;
	rct.right = y;
	rct.top = x + 10;
	rct.bottom=rct.top + 20;

	// Draw some text
	m_pFont->DrawText(NULL, szText.c_str(), -1, &rct, 0, d3Color );

}